﻿<!DOCTYPE html>
<html lang="en">
<head>
    <title>宾果高校</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <link rel="stylesheet" href="../css/bootstrap.min.css">
    <link rel="stylesheet" href="../css/style.css">
    <link rel="stylesheet" href="../css/sweetalert.min.css" />
    <script src="../js/jquery-1.12.2.min.js"></script>
    <script src="../js/common.js"></script>
    <script src="../js/sweetalert.min.js"></script>
    <script src="../js/angular.min.js"></script>
    <script src="../js/Controller.js"></script>

</head>
<body id="bodyContent">
    <div id="searchPage"></div>
    <div class="main">
        <div class="wrap">
            <div ng-app="myApp2" class="panel panel-default">
                <div ng-controller="sponsorDetailsCtrl" class="panel-body">
                    <table ng-model="names" class="table table-hover">
                        <tr>
                            <td>赞助名称</td>
                            <td>{{names.ProjectName}}</td>
                        </tr>
                        <tr>
                            <td>赞助类型</td>
                            <td><span ng-repeat="w in names.Type">{{w + ","}}</span></td>
                        </tr>
                        <tr>
                            <td>活动地区</td>
                            <td><span ng-repeat="y in names.City">{{y + ","}}</span></td>
                        </tr>
                        <tr>
                            <td>赞助提供金额</td>
                            <td>{{names.Money}}</td>
                        </tr>
                        <tr>
                            <td>赞助提供物资</td>
                            <td><span ng-repeat="z in names.Material">{{z + ","}}</span></td>
                        </tr>
                        <tr>
                            <td>赞助希望涉及学生总数（人）</td>
                            <td>{{names.EntrantsName}}</td>
                        </tr>
                        <tr>
                            <td>赞助时间（开始时间-结束时间）</td>
                            <td>{{names.StartTime | date:'yyyy-MM-dd'}} 至 {{names.EndTime | date:'yyyy-MM-dd'}}</td>
                        </tr>
                        <tr>
                            <td>方案要求</td>
                            <td>{{names.ProjectRequire}}</td>
                        </tr>
                        <tr>
                            <td>方案下载</td>
                            <td>
                                <a href="{{names.FileSys.Path}}" target="_blank" class="btn btn-default btn-xs">下载</a>
                            </td>
                        </tr>
                    </table>
                    <div class="text-center">
                        <button class="btn btn-default" onclick="Go()">确定合作</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
</html>
<script>

    $("#searchPage").load("header.html", function () {
        SetCss("Spon");
    });

    var param = common.getUrlArgStr();
    if (param.id == undefined || param.id == "")
        window.location = "sponsor.html";

    var app = angular.module('myApp2', []);

    app.controller('sponsorDetailsCtrl', function ($http, $scope) {

        $http.get('../api/project/get/' + param.id).success(function (data) {

            if (data == null)
                window.location = "login.html";

            $scope.names = data.ResponseObj;
        }).error(function (data, status, headers, config) {
            common.alertMessage(data.Message, status);
        });
    });

    function AfteAjax(ctx) {
        var data = ctx.ResponseDict;

        if (data != null && data.message != undefined) {
            common.alertMessage(data.message);
            return;
        }
        
        window.location = "SponsorInfo.aspx?id=" + param.id;
    }

    function Go() {
        common.commonAjax({ type: 'get', url: '../api/student/ListApprovingActivity', sMethod: AfteAjax, loadingCtrl: $("#bodyContent") });
    }

</script>